Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom authentication handlers for private pypi. #8250

Closed
wants to merge 1 commit into from

Conversation

fedorbirjukov
Copy link

@fedorbirjukov fedorbirjukov commented May 16, 2020

PR for #4475

MultiDomainBasicAuth is no longer the only option, it's just the default implementation.
Use --auth option to specify the plugin/handler that should be used.
Help message for this option lists all available/installed authentication plugins.

A plugin consists of:

  • a module that implements class Auth, and
  • an entrypoint, such as "pip.auth_plugins": "win-sso=pip-win-sso-auth"

Copy link
Contributor

@McSinyx McSinyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for filing this PR! Below are some tiny nits (keep in mind that I am not in the position to approve or oppose the general idea, the nits are purely for the implementation), and don't forget to add some tests.

Comment on lines +241 to +243
auth_class = kwargs.pop("auth_class", None)
if auth_class is None:
auth_class = MultiDomainBasicAuth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auth_class = kwargs.pop("auth_class", None)
if auth_class is None:
auth_class = MultiDomainBasicAuth
auth_class = kwargs.pop("auth_class", MultiDomainBasicAuth)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not work because this named argument is always provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I missed that. How about provide it with MultiDomainBasicAuth as suggested below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that at first. But None is a better default IMO. This way cli is not coupled with network. Currently MultiDomainBasicAuth is not a plugin, it's the default implementation.


auth_plugin = partial(
PipOption,
'--auth', '--auth-plugin',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an user, I would find this to be confusing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's confusing about this. It's quite common for options to have multiple names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find auth and auth-plugin to have different first-impression meaning, but I don't represent all users so no worries, stick to what you think is best.

Copy link
Author

@fedorbirjukov fedorbirjukov May 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. It's similar to the '--src' option, which has three longer names: '--source', '--source-dir', '--source-directory'. The longer the name - the more informative and clear it is. Shorter names are easier to type. Let's see if others find it confusing, too.
@McSinyx Don't worry. Your thoughts and perceptions are welcome. Thanks for thinking with me.

dest='auth_class',
type='choice',
metavar='plugin',
default=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to have MultiDomainBasicAuth here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered this. But didn't want to couple cli and network code.

Comment on lines +948 to +949
help='Specify authentication plugin to be used: {}.'.format(
', '.join(discovered_auth_plugins.keys()) or 'no plugins found'
Copy link
Contributor

@McSinyx McSinyx May 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can phrase this better in case no plugin found. Personally I'm bad at making concise sentences so I can't offer any suggestion though.

@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Jul 5, 2020
@pradyunsg
Copy link
Member

Closing due to lack of movement here. Please feel free to file a new PR if you want to get the ball rolling again! :)

@pradyunsg pradyunsg closed this Feb 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs rebase or merge PR has conflicts with current master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants